<?php


namespace app\api\controller;

use app\common\controller\Api;
use app\common\model\UserEnterprise;

class Business extends Api
{
    protected $noNeedLogin = '';
    protected $noNeedRight = '*';

    public function _initialize()
    {
        parent::_initialize();
    }

    /**
     * 企业详情资料
     */
    public function home()
    {
        $user_id = input('param.user_id',0, 'intval');
        if (!$user_id){
            $this->error('参数错误');
        }
        if (!$row = UserEnterprise::get($user_id)){
            $this->error('未查到该企业');
        }
        if ($row->certification_status != 1 && $row->user_id != $this->auth->id){
            $this->error('该企业尚未完成认证');
        }
        $row->user = \app\common\model\User::get($user_id);
        $this->success('', $row);
    }
}